package com.wang.singleton;

public class HungerSingleton {

    public static void main(String[] args) {
        HungerSingleton singleton = HungerSingleton.getInstance();
        HungerSingleton singleton1 = HungerSingleton.getInstance();
        System.out.println(singleton == singleton1);
    }

    private static final HungerSingleton singleton = new HungerSingleton();

    //构造函数设置为私有
    private HungerSingleton(){}

    public static HungerSingleton getInstance(){
        return singleton;
    }
}
